package com.bolt.auth.admin.api.sys.dto;

import com.bolt.auth.admin.api.sys.entity.PrivilegeEntity;
import com.bolt.convention.data.BaseDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * Created by Administrator on 2021/3/5.
 */
@Data
public class PrivilegeDTO extends BaseDTO {
    /**
     * * ID
     **/
    private String id;


    /**
     * * 权限代码
     **/
    @ApiModelProperty(notes = "权限代码")
    private String code;


    /**
     * * 是否可用
     **/
    @ApiModelProperty(notes = "是否可用")
    private Boolean enabled;


    /**
     * * 关联菜单
     **/
    @ApiModelProperty(notes = "关联菜单")
    private Long menuId;


    /**
     * * 排序号
     **/
    @ApiModelProperty(notes = "排序号")
    private Integer orderRank;


    /**
     * * 类型
     **/
    @ApiModelProperty(notes = "类型")
    private PrivilegeEntity.PrivilegeTypeEnum type;


    /**
     * * 权限名称
     **/
    @ApiModelProperty(notes = "权限名称")
    private String title;


    @ApiModelProperty(notes = "")
    private Integer versionNo;


    /**
     * * 父节点
     **/
    @ApiModelProperty(notes = "父节点")
    private String pid;


    /**
     * * 子节点数
     **/
    @ApiModelProperty(notes = "子节点数")
    private Integer childrenSize;


    /**
     * * 节点深度
     **/
    @ApiModelProperty(notes = "节点深度")
    private Integer inheritLevel;

    public Boolean getHasChildren() {
        return childrenSize > 0;
    }

    public Boolean getLeaf() {
        return childrenSize == 0;
    }

    public String getLabel() {
        return title;
    }
}

 